<?php
  $xml = simplexml_load_file("http://news.google.com/news?ned=es&topic=s&output=atom");
  
  $items = count($xml->entry);
  
  $primera = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
  <html xmlns=\"http://www.w3.org/1999/xhtml\">
    <head>
      <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
      <title>AAP</title>
    </head>
    <body>
      <table border=\"1\">\n";
     
  $segunda = "";

  $segunda .= "        <tr>\n";
  $segunda .= "          <td align=\"center\">TÍTULO</td>\n";
  $segunda .= "          <td align=\"center\">FECHA</td>\n";
  $segunda .= "        </tr>\n";     
  
  for($i = 0; $i < $items; $i++) {
    $segunda .= "        <tr>\n";  
    $segunda .= "          <td>".$xml->entry[$i]->title."</td>"."\n";
    $segunda .= "          <td>".$xml->entry[$i]->updated."</td>"."\n";
    $segunda .= "        </tr>\n";
  }

  $tercera = "      </table> 
    </body>
  </html>";

  echo $primera.$segunda.$tercera;
?> 
